program /*ZMEIKA*/;
Var x,y,i:integer;
    j:byte;
    XCirc,YCirc,Rad:array[1..10]of integer;
    Cvet,FlagPravoGran,FlagNizGran:array[1..10]of byte;
Begin
 For i:=1 to 10 do
 {XCirc[i]:=50+i*10;
  YCirc[i]:=50+i*10;
  Rad[i]:=20;
  FlagPravoGran[i]:=2;
  FlagNizGran[i]:=2;
 }
 Cvet[1]:=1;
 Cvet[2]:=2;
 Cvet[3]:=3;
 Cvet[4]:=4;
 Cvet[5]:=5;
 Cvet[6]:=1;
 Cvet[7]:=2;
 Cvet[8]:=3;
 Cvet[9]:=4;
 Cvet[10]:=5;
 InitGraph;
 For i:=1 to 1000 do
 {For j:=1 to 10 do
  {Circle(XCirc[j],YCirc[j],Rad[j],0);
   if XCirc[j]>=320-rad[j] then {FlagPravoGran[j]:=2;}
   if YCirc[j]>=200-rad[j] then {FlagNizGran[j]:=2;}
   if XCirc[j]<=rad[j] then {FlagPravoGran[j]:=1;}
   if YCirc[j]<=rad[j] then {FlagNizGran[j]:=1;}
   if FlagPravoGran[j]=2 then {XCirc[j]:=Xcirc[j]-1;} else {XCirc[j]:=XCirc[j]+1;}
   if FlagNizGran[j]=2 then {YCirc[j]:=YCirc[j]-1;} else {YCirc[j]:=Ycirc[j]+1;}
   Circle(XCirc[j],Ycirc[j],Rad[j],Cvet[j]);
  }
 }
 CloseGraph;
END.